Skip to main content

微信支付 之 微信维权通知URL

//微信维权通知URL

define('IN_ECS', true);
require(dirname(__FILE__) . '/includes/init.php');

writeLog();

$xml = file_get_contents('php://input');
$xml = new SimpleXMLElement($xml);

$insertData['OpenId'] = (string)$xml->OpenId ; //用户id
$insertData['AppId'] = (string)$xml->AppId ; //公众号id
$insertData['TimeStamp'] = (string)$xml->TimeStamp ; //当前时间
$insertData['MsgType'] = (string)$xml->MsgType ; //request 用户提交投诉 confir用户确认消除 reject 用户拒绝消除投诉
$insertData['FeedBackId'] = (string)$xml->FeedBackId ; //投诉单号
$insertData['Reason'] = (string)$xml->Reason ; //用户投诉原因
$insertData['Solution'] = (string)$xml->Solution ; //用户希望解决方案
$insertData['ExtInfo'] = (string)$xml->ExtInfo ; //备注信息+电话
$insertData['AppSignature'] = (string)$xml->AppSignature ; //sha1算法得到的结果。
$insertData['SignMethod'] = (string)$xml->SignMethod ; //加密方式

$GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('weixin_weiquan'),$insertData);

function writeLog()
{
logResult('REQUEST: '.json_encode($_REQUEST));
logResult('GET: '.json_encode($_GET));
logResult('POST: '.json_encode($_POST));
$xml = file_get_contents('php://input');
logResult('XML: '.$xml);
}
function logResult($word='') {
$url = $_SERVER['PHP_SELF'];
$filename = substr( $url , strrpos($url , '/')+1 );
$filename = substr($filename,0,-4).'.txt';

$fp = fopen($filename ,"a");
flock($fp, LOCK_EX) ;
fwrite($fp,"执行日期:".strftime("%Y%m%d%H%m%s",time())."\n".$word."\n");
flock($fp, LOCK_UN);
fclose($fp);
}